import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { SPlayerItem } from "../../../../../Message/Public/SPlayerItem";
import { ItemData } from "../../../resource/info/ItemData";
import { BaseItem } from "../BaseItem";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
type int = number;
//class PageItemRenderer
    
    export  class PageItemRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            setSize(36, 36);
            this.initItem();
            this.mouseChildren = true;
            this.mouseEnabled = true;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            if (arg1 == PageItemRenderer.NullItem) 
            {
                DisplayUtil.removeMe(this._item);
                return;
            }
            this.addChild(this._item);
            if (typeof arg1 === "splayeritem") 
            {
                this._item.itemData = new ItemData(arg1);
                this.mouseChildren = true;
            }
            else if (typeof arg1 === "int") 
            {
                this._item.itemData = new ItemData(int(arg1));
            }
            else 
            {
                this._item.itemData = arg1 as ItemData;
            }
            return;
        }

        public get item(): BaseItem
        {
            return this._item;
        }

        protected initItem(): void
        {
            var loc1=GlobalClass.getBitmap(ImagesConst.PackItemBg);
            addChildAt(loc1, 0);
            this._item = new BaseItem();
            this._item.width = 32;
            this._item.height = 32;
            this._item.isDragAble = false;
            this._item.isDropAble = false;
            this._item.x = 3;
            this._item.y = 3;
            this._item.isShowLock = true;
            this.addChild(this._item);
            return;
        }

        public static /* const */NullItem: int=-1;

        protected /* var */_item: BaseItem;
    }
